(function() {

    "use strict";

    describe("TemplateTestCase", function() {

        var html = "<script id='view-template' type='text/template'>" +
            "<input type='text' name='message' value='<%= test %>' id='msg'></script>" +
            "<div id='panel'></div>";

        var element = document.createElement("form");
        element.innerHTML = html;

        var body = document.getElementsByTagName("body")[0];
        body.appendChild(element);

        beforeEach(function() {
            this.domPlugin = {getHtml:window.stubFn(document.getElementById("view-template").innerHTML), //{findBySelector: window.stubFn(document.getElementById("#view-template"))
                setHtml:window.stubFn()};

            this.templatePlugin = new nw.plugins.Template(this.domPlugin);
        });

        it("should render template", function() {
            var view = {};
            var model = {test: "welcome"};
            this.templatePlugin.render("#view-template", view, model);

            expect(this.domPlugin.getHtml.called).to.be.ok();
            expect(this.domPlugin.getHtml.args[0]).to.eql("#view-template");
            expect(this.domPlugin.setHtml.called).to.be.ok();
            expect(this.domPlugin.setHtml.args[0]).to.eql(view);
            expect(this.domPlugin.setHtml.args[1]).to.eql("<input type='text' name='message' value='welcome' id='msg'>");
        });

    });
}());